<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="custom-style.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
	<div style="overflow: hidden;">
		<div style="height: 57px;min-width: 1039px;background-size: auto 100%;background:url('');">
			<img src="titleleft.png" style="float: left;"/>
			<img src="titleright.png" alt="" style="float: right;" />
		</div>
	</div>
<!-- 制作者 Doxygen 1.8.15 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>法律声明</span></a></li>
      <li><a href="_xE9_xA6_x96_xE9_xA1_xB5.html"><span>首页</span></a></li>
      <li><a href="_xE6_x9B_xB4_xE6_x96_xB0_xE8_xAE_xB0_xE5_xBD_x95.html"><span>更新记录</span></a></li>
      <li><a href="_xE7_x8E_xAF_xE5_xA2_x83_xE9_x85_x8D_xE7_xBD_xAE.html"><span>环境配置</span></a></li>
      <li><a href="_xE7_xBC_x96_xE7_xA8_x8B_xE5_xBC_x95_xE5_xAF_xBC.html"><span>编程引导</span></a></li>
      <li><a href="modules.html"><span>接口说明</span></a></li>
      <li><a href="annotated.html"><span>结构体定义</span></a></li>
      <li><a href="_xE7_x9B_xB8_xE6_x9C_xBA_xE5_x8F_x82_xE6_x95_xB0_xE8_x8A_x82_xE7_x82_xB9_xE8_xA1_xA8.html"><span>相机参数节点表</span></a></li>
      <li><a href="examples.html"><span>示例程序</span></a></li>
      <li><a href="_xE9_x94_x99_xE8_xAF_xAF_xE7_xA0_x81.html"><span>状态码</span></a></li>
      <li><a href="_xE5_xB8_xB8_xE8_xA7_x81_xE9_x97_xAE_xE9_xA2_x98.html"><span>常见问题</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">ForceIPEx.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>强制设置相机IP</p>
<p>该示例程序说明如何强制设置网口相机IP，保证断电后重新连接，重新枚举后依旧生效。</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;unistd.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;pthread.h&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;MvCameraControl.h&quot;</span></div><div class="line"><span class="preprocessor">#include &lt;arpa/inet.h&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define PERSISTENT_CONFIG_REG 0x0014</span></div><div class="line"><span class="preprocessor">#define PERSISTENT_IPADDR_REG 0x064C</span></div><div class="line"><span class="preprocessor">#define PERSISTENT_SUBNETMASK_REG 0x065C</span></div><div class="line"><span class="preprocessor">#define PERSISTENT_DEFAULTGATEWAY_REG 0x066C</span></div><div class="line"></div><div class="line"><span class="comment">// 等待用户输入enter键来结束取流或结束程序</span></div><div class="line"><span class="comment">// wait for user to input enter to stop grabbing or end the sample program</span></div><div class="line"><span class="keywordtype">void</span> PressEnterToExit(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <span class="keywordtype">int</span> c;</div><div class="line">    fprintf( stderr, <span class="stringliteral">&quot;\nPress enter to exit.\n&quot;</span>);</div><div class="line">    <span class="keywordflow">while</span>( getchar() != <span class="charliteral">&#39;\n&#39;</span>);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">bool</span> ConvertToHexIp(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *nHexIP, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *nDecIP, <span class="keywordtype">char</span> c)</div><div class="line">{</div><div class="line">    <span class="keywordflow">if</span> ( nDecIP[0] &lt; 0 || nDecIP[0] &gt; 255</div><div class="line">        || nDecIP[1] &lt; 0 || nDecIP[1] &gt; 255</div><div class="line">        || nDecIP[2] &lt; 0 || nDecIP[2] &gt; 255</div><div class="line">        || nDecIP[3] &lt; 0 || nDecIP[3] &gt; 255</div><div class="line">        || c != <span class="charliteral">&#39;\n&#39;</span>)</div><div class="line">    {</div><div class="line">        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line">    }</div><div class="line">    *nHexIP = (nDecIP[0] &lt;&lt; 24) + (nDecIP[1] &lt;&lt; 16) + (nDecIP[2] &lt;&lt; 8) + nDecIP[3];</div><div class="line"></div><div class="line">    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">bool</span> PrintDeviceInfo(<a name="_a0"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html">MV_CC_DEVICE_INFO</a>* pstMVDevInfo)</div><div class="line">{</div><div class="line">    <span class="keywordflow">if</span> (NULL == pstMVDevInfo)</div><div class="line">    {</div><div class="line">        printf(<span class="stringliteral">&quot;The Pointer of pstMVDevInfo is NULL!\n&quot;</span>);</div><div class="line">        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line">    }</div><div class="line">    <span class="keywordflow">if</span> (pstMVDevInfo-&gt;<a name="a1"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3b26b1c9681dba57af81bdb7ed795575">nTLayerType</a> == <a name="a2"></a><a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#gae1780ad0d41bcd2e835ab81155b398e6">MV_GIGE_DEVICE</a>)</div><div class="line">    {</div><div class="line">        <span class="keywordtype">int</span> nIp1 = ((pstMVDevInfo-&gt;<a name="a3"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a name="a4"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a5"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0xff000000) &gt;&gt; 24);</div><div class="line">        <span class="keywordtype">int</span> nIp2 = ((pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0x00ff0000) &gt;&gt; 16);</div><div class="line">        <span class="keywordtype">int</span> nIp3 = ((pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0x0000ff00) &gt;&gt; 8);</div><div class="line">        <span class="keywordtype">int</span> nIp4 = (pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0x000000ff);</div><div class="line"></div><div class="line">        <span class="comment">// ch:打印当前相机ip和用户自定义名字 | en:print current ip and user defined name</span></div><div class="line">        printf(<span class="stringliteral">&quot;Device Model Name: %s\n&quot;</span>, pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a6"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#a0444c9bb101455ec9303a2c0cf9052c1">chModelName</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;CurrentIp: %d.%d.%d.%d\n&quot;</span> , nIp1, nIp2, nIp3, nIp4);</div><div class="line">        printf(<span class="stringliteral">&quot;UserDefinedName: %s\n\n&quot;</span> , pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a7"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aae7ffce31c7dd8e1c98aab32776e5080">chUserDefinedName</a>);</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3b26b1c9681dba57af81bdb7ed795575">nTLayerType</a> == <a name="a8"></a><a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#ga356c3a2b4efad3bea955ecb54e1632fe">MV_USB_DEVICE</a>)</div><div class="line">    {</div><div class="line">        printf(<span class="stringliteral">&quot;Device Model Name: %s\n&quot;</span>, pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a name="a9"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3bea622a6d4adb297c2a8c99f28c54eb">stUsb3VInfo</a>.<a name="a10"></a><a class="code" href="struct_m_v___u_s_b3___d_e_v_i_c_e___i_n_f_o.html#a1fd78924df9302fb6421706ddb10c6db">chModelName</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;UserDefinedName: %s\n\n&quot;</span>, pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3bea622a6d4adb297c2a8c99f28c54eb">stUsb3VInfo</a>.<a name="a11"></a><a class="code" href="struct_m_v___u_s_b3___d_e_v_i_c_e___i_n_f_o.html#a5749014e9a3d16bdca2d0cfb9f1f7e16">chUserDefinedName</a>);</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        printf(<span class="stringliteral">&quot;Not support.\n&quot;</span>);</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">    <span class="keywordtype">int</span> nRet = MV_OK;</div><div class="line">    <span class="keywordtype">void</span>* handle = NULL;</div><div class="line">    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nIP[4] = {0};</div><div class="line">    <span class="keywordtype">char</span> c = <span class="charliteral">&#39;\0&#39;</span>;</div><div class="line">    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nIpAddr = 0, nNetWorkMask = 0, nDefaultGateway = 0;</div><div class="line">    <span class="keywordflow">do</span> </div><div class="line">    {</div><div class="line">        <span class="comment">// ch:初始化SDK | en:Initialize SDK</span></div><div class="line">        nRet = <a name="a12"></a><a class="code" href="group___s_d_k_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga768544eb6e6435313dd99ee9cf92d59d">MV_CC_Initialize</a>();</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Initialize SDK fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <a name="_a13"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html">MV_CC_DEVICE_INFO_LIST</a> stDeviceList;</div><div class="line">        memset(&amp;stDeviceList, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html">MV_CC_DEVICE_INFO_LIST</a>));</div><div class="line"></div><div class="line">        <span class="comment">// 枚举设备</span></div><div class="line">        <span class="comment">// enum device</span></div><div class="line">        nRet = <a name="a14"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga88741869e2b3c12e47025e53e6a7b58b">MV_CC_EnumDevices</a>(<a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#gae1780ad0d41bcd2e835ab81155b398e6">MV_GIGE_DEVICE</a>, &amp;stDeviceList);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;MV_CC_EnumDevices fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span> (stDeviceList.<a name="a15"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a> &gt; 0)</div><div class="line">        {</div><div class="line">            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a>; i++)</div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;[device %d]:\n&quot;</span>, i);</div><div class="line">                <a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html">MV_CC_DEVICE_INFO</a>* pDeviceInfo = stDeviceList.<a name="a16"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[i];</div><div class="line">                <span class="keywordflow">if</span> (NULL == pDeviceInfo)</div><div class="line">                {</div><div class="line">                    <span class="keywordflow">break</span>;</div><div class="line">                } </div><div class="line">                PrintDeviceInfo(pDeviceInfo);            </div><div class="line">            }  </div><div class="line">        } </div><div class="line">        <span class="keywordflow">else</span></div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Find No Devices!\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        printf(<span class="stringliteral">&quot;Please Intput camera index: &quot;</span>);</div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nIndex = 0;</div><div class="line">        scanf(<span class="stringliteral">&quot;%d&quot;</span>, &amp;nIndex);</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span> (nIndex &gt;= stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a>)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Intput error!\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">// 选择设备并创建句柄</span></div><div class="line">        <span class="comment">// select device and create handle</span></div><div class="line">        nRet = <a name="a17"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#gaf10f0644caa6d4dd39fd8c14f8736153">MV_CC_CreateHandle</a>(&amp;handle, stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;MV_CC_CreateHandle fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        </div><div class="line">        <span class="comment">//记录第一次的序列号</span></div><div class="line">        <span class="comment">//Record the serial number for the first time</span></div><div class="line">        <span class="keywordtype">char</span> chSerialNumber[16] = {0};</div><div class="line">        memcpy(chSerialNumber, stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a18"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#ae80e2dda7c51b50794423ec63a9130ca">chSerialNumber</a>, <span class="keyword">sizeof</span>(stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#ae80e2dda7c51b50794423ec63a9130ca">chSerialNumber</a>));</div><div class="line">        printf(<span class="stringliteral">&quot;serial number：[%s]\n&quot;</span>, chSerialNumber);</div><div class="line"></div><div class="line">        <span class="comment">// 输入IP 子网掩码 默认网关</span></div><div class="line">        <span class="comment">// input ip, subnet mask and defaultway</span></div><div class="line">        printf(<span class="stringliteral">&quot;Please input ip, example: 192.168.1.100\n&quot;</span>);</div><div class="line">        <span class="keywordtype">int</span> ch;</div><div class="line">        <span class="keywordflow">if</span> ( 5 != scanf(<span class="stringliteral">&quot;%d.%d.%d.%d%c&quot;</span>, &amp;nIP[0], &amp;nIP[1], &amp;nIP[2], &amp;nIP[3], &amp;c) )</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;input count error\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="keywordflow">if</span> (!ConvertToHexIp(&amp;nIpAddr, nIP, c))</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;input IpAddr format is not correct\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        printf(<span class="stringliteral">&quot;Please input NetMask, example: 255.255.255.0\n&quot;</span>);</div><div class="line">        <span class="keywordflow">if</span> ( 5 != scanf(<span class="stringliteral">&quot;%d.%d.%d.%d%c&quot;</span>, &amp;nIP[0], &amp;nIP[1], &amp;nIP[2], &amp;nIP[3], &amp;c) )</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;input count error\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="keywordflow">if</span> (!ConvertToHexIp(&amp;nNetWorkMask, nIP, c))</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;input NetMask format is not correct\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        printf(<span class="stringliteral">&quot;Please input DefaultWay, example: 192.168.1.1\n&quot;</span>);</div><div class="line">        <span class="keywordflow">if</span> ( 5 != scanf(<span class="stringliteral">&quot;%d.%d.%d.%d%c&quot;</span>, &amp;nIP[0], &amp;nIP[1], &amp;nIP[2], &amp;nIP[3], &amp;c) )</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;input count error\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="keywordflow">if</span> (!ConvertToHexIp(&amp;nDefaultGateway, nIP, c))</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;input DefaultWay format is not correct\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        </div><div class="line">        <span class="comment">//判断设备Ip是否可达</span></div><div class="line">        <span class="comment">//Determine whether the IP address is reachable</span></div><div class="line">        <span class="keywordtype">bool</span> bAccessible = <a name="a19"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga3c3ffcbd330529ee076433ef36d226f5">MV_CC_IsDeviceAccessible</a>(stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex], <a name="a20"></a><a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#ga37a90411f6aa059bfb76d3ac0aad3602">MV_ACCESS_Exclusive</a>);</div><div class="line">        <span class="keywordflow">if</span>(bAccessible)</div><div class="line">        {</div><div class="line">            <span class="comment">//ch:设置IP配置选项 | en:set ipconfig</span></div><div class="line">            nRet = <a name="a21"></a><a class="code" href="group___gig_e_xE7_x9B_xB8_xE6_x9C_xBA.html#ga4fc5a7292438b36b7ec215508158b799">MV_GIGE_SetIpConfig</a>(handle, <a name="a22"></a><a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#ga3f769aa8872c6fd1c1147e7460745c63">MV_IP_CFG_STATIC</a>);</div><div class="line">            <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;MV_GIGE_SetIpConfig fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">                <span class="keywordflow">break</span>;</div><div class="line">            }</div><div class="line">            printf(<span class="stringliteral">&quot;set IPConfig succeed\n&quot;</span>);</div><div class="line">            </div><div class="line">            <span class="comment">//ch:设置强制IP | en:set forceip</span></div><div class="line">            nRet = <a name="a23"></a><a class="code" href="group___gig_e_xE7_x9B_xB8_xE6_x9C_xBA.html#ga019f997779fa34774274305d4c9f4304">MV_GIGE_ForceIpEx</a>(handle, nIpAddr, nNetWorkMask, nDefaultGateway);</div><div class="line">            <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">            {   </div><div class="line">                printf(<span class="stringliteral">&quot;MV_GIGE_ForceIpEx fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">                <span class="keywordflow">break</span>;</div><div class="line">            }</div><div class="line">            printf(<span class="stringliteral">&quot;set IP succeed\n&quot;</span>);</div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span></div><div class="line">        {</div><div class="line">            <span class="comment">//ch:设置强制IP | en:set forceip</span></div><div class="line">            nRet = <a class="code" href="group___gig_e_xE7_x9B_xB8_xE6_x9C_xBA.html#ga019f997779fa34774274305d4c9f4304">MV_GIGE_ForceIpEx</a>(handle, nIpAddr, nNetWorkMask, nDefaultGateway);</div><div class="line">            <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">            {   </div><div class="line">                printf(<span class="stringliteral">&quot;MV_GIGE_ForceIpEx fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">                <span class="keywordflow">break</span>;</div><div class="line">            }</div><div class="line">            printf(<span class="stringliteral">&quot;set IP succeed\n&quot;</span>);</div><div class="line">            </div><div class="line">            <a name="a24"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga0f74372a22e8a19fa7e21dad45070428">MV_CC_DestroyHandle</a>(handle);</div><div class="line">            handle = NULL;</div><div class="line">            </div><div class="line">            <span class="comment">//ch:需要重新创建句柄，设置为静态IP方式进行保存 | en:re-create the handle and set it to static IP for storage</span></div><div class="line">            stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> = nIpAddr;</div><div class="line">            stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a25"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#a2d6afd0030e396d86a096936328763bd">nCurrentSubNetMask</a> = nNetWorkMask;</div><div class="line">            stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a26"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#a2a75d509774e977d6ec4aae8bf9d3244">nDefultGateWay</a> = nDefaultGateway;</div><div class="line">            nRet = <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#gaf10f0644caa6d4dd39fd8c14f8736153">MV_CC_CreateHandle</a>(&amp;handle, stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]);</div><div class="line">            <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;MV_CC_CreateHandle fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">                <span class="keywordflow">break</span>;</div><div class="line">            }</div><div class="line">            <span class="comment">//ch:设置IP配置选项 | en:set ipconfig</span></div><div class="line">            nRet = <a class="code" href="group___gig_e_xE7_x9B_xB8_xE6_x9C_xBA.html#ga4fc5a7292438b36b7ec215508158b799">MV_GIGE_SetIpConfig</a>(handle, <a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#ga3f769aa8872c6fd1c1147e7460745c63">MV_IP_CFG_STATIC</a>);</div><div class="line">            <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;MV_GIGE_SetIpConfig fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">                <span class="keywordflow">break</span>;</div><div class="line">            }</div><div class="line">            printf(<span class="stringliteral">&quot;set IPConfig succeed\n&quot;</span>);</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">//ch:销毁句柄 | en:Destroy handle</span></div><div class="line">        nRet = <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga0f74372a22e8a19fa7e21dad45070428">MV_CC_DestroyHandle</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;MV_CC_DestroyHandle fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        handle = NULL;</div><div class="line"></div><div class="line">        <span class="comment">//设置完forceip后重新枚举一下 | en:After setting up ForceIP, re-enumerate it</span></div><div class="line">        usleep(1*1000*500);</div><div class="line">        nIndex = -1;</div><div class="line">        handle = NULL;</div><div class="line">        memset(&amp;stDeviceList, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html">MV_CC_DEVICE_INFO_LIST</a>));</div><div class="line">        nRet = <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga88741869e2b3c12e47025e53e6a7b58b">MV_CC_EnumDevices</a>(<a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#gae1780ad0d41bcd2e835ab81155b398e6">MV_GIGE_DEVICE</a> | <a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#ga356c3a2b4efad3bea955ecb54e1632fe">MV_USB_DEVICE</a>, &amp;stDeviceList);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Enum Devices fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span> (stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a> &gt; 0)</div><div class="line">        {</div><div class="line">            <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a>; i++)</div><div class="line">            {</div><div class="line"></div><div class="line">                <a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html">MV_CC_DEVICE_INFO</a>* pDeviceInfo = stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[i];</div><div class="line">                <span class="keywordflow">if</span> (NULL == pDeviceInfo)</div><div class="line">                {</div><div class="line">                    printf(<span class="stringliteral">&quot;pointer invalid!\n&quot;</span>);</div><div class="line">                    <span class="keywordflow">break</span>;</div><div class="line">                } </div><div class="line">                <span class="comment">//根据序列号进行比较 | en:Compare based on serial numbers</span></div><div class="line">                <span class="keywordflow">if</span> (!strcmp(chSerialNumber, (<span class="keywordtype">char</span>*)(pDeviceInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#ae80e2dda7c51b50794423ec63a9130ca">chSerialNumber</a>)))</div><div class="line">                {</div><div class="line">                    nIndex = i;</div><div class="line">                    printf(<span class="stringliteral">&quot;find it, serial number：[%s]\n&quot;</span>, pDeviceInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#ae80e2dda7c51b50794423ec63a9130ca">chSerialNumber</a>);</div><div class="line">                    <span class="keywordflow">break</span>;</div><div class="line">                }</div><div class="line">            }  </div><div class="line">        } </div><div class="line">        <span class="keywordflow">else</span></div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Find No Devices!\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="keywordflow">if</span> (-1 == nIndex)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Not Find First Device\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">// ch:选择设备并创建句柄 | en:Select device and create handle</span></div><div class="line">        nRet = <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#gaf10f0644caa6d4dd39fd8c14f8736153">MV_CC_CreateHandle</a>(&amp;handle, stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Create Handle fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">// ch:打开设备 | en:Open device</span></div><div class="line">        nRet = <a name="a27"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga308c9a9869be7a457d27aadd94ce57dd">MV_CC_OpenDevice</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Open Device fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="comment">//ch:设置presistentip | en:set presistentip</span></div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nConfig = htonl(0x05);</div><div class="line">        nRet = <a name="a28"></a><a class="code" href="group___xE8_xAF_xBB_xE5_x86_x99_xE5_xAF_x84_xE5_xAD_x98_xE5_x99_xA8.html#ga562f528fbfd3953f85b9f8ce93639d18">MV_CC_WriteMemory</a>(handle, (<span class="keyword">const</span> <span class="keywordtype">void</span>*)&amp;(nConfig), PERSISTENT_CONFIG_REG, <span class="keyword">sizeof</span>(nConfig));</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;write config fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nIpAddr1 = htonl(nIpAddr);</div><div class="line">        nRet = <a class="code" href="group___xE8_xAF_xBB_xE5_x86_x99_xE5_xAF_x84_xE5_xAD_x98_xE5_x99_xA8.html#ga562f528fbfd3953f85b9f8ce93639d18">MV_CC_WriteMemory</a>(handle, (<span class="keyword">const</span> <span class="keywordtype">void</span>*)&amp;(nIpAddr1), PERSISTENT_IPADDR_REG, <span class="keyword">sizeof</span>(nIpAddr));</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;write ip fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        </div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nNetWorkMask1 = htonl(nNetWorkMask);</div><div class="line">        nRet = <a class="code" href="group___xE8_xAF_xBB_xE5_x86_x99_xE5_xAF_x84_xE5_xAD_x98_xE5_x99_xA8.html#ga562f528fbfd3953f85b9f8ce93639d18">MV_CC_WriteMemory</a>(handle, (<span class="keyword">const</span> <span class="keywordtype">void</span>*)&amp;(nNetWorkMask1), PERSISTENT_SUBNETMASK_REG, <span class="keyword">sizeof</span>(nNetWorkMask));</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;write nNetWorkMask fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        </div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nDefaultGateway1 = htonl(nDefaultGateway);</div><div class="line">        nRet = <a class="code" href="group___xE8_xAF_xBB_xE5_x86_x99_xE5_xAF_x84_xE5_xAD_x98_xE5_x99_xA8.html#ga562f528fbfd3953f85b9f8ce93639d18">MV_CC_WriteMemory</a>(handle, (<span class="keyword">const</span> <span class="keywordtype">void</span>*)&amp;(nDefaultGateway1), PERSISTENT_DEFAULTGATEWAY_REG, <span class="keyword">sizeof</span>(nDefaultGateway));</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;write nDefaultGateway fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        </div><div class="line">        <span class="comment">// ch:关闭设备 | Close device</span></div><div class="line">        nRet = <a name="a29"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga33853bd328f46492102246ca8b645d57">MV_CC_CloseDevice</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Close device fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="comment">// ch:销毁句柄 | Destroy handle</span></div><div class="line">        nRet = <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga0f74372a22e8a19fa7e21dad45070428">MV_CC_DestroyHandle</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Destroy Handle fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        handle = NULL;</div><div class="line">        printf(<span class="stringliteral">&quot;Persisent ForceIp Success!\n&quot;</span>);</div><div class="line">    } <span class="keywordflow">while</span> (0);</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (handle != NULL)</div><div class="line">    {</div><div class="line">        <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga0f74372a22e8a19fa7e21dad45070428">MV_CC_DestroyHandle</a>(handle);</div><div class="line">        handle = NULL;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">// ch:反初始化SDK | en:Finalize SDK</span></div><div class="line">    <a name="a30"></a><a class="code" href="group___s_d_k_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#gafa1820a0da8671fc6f77dc9a7dfa69d3">MV_CC_Finalize</a>();</div><div class="line"></div><div class="line">    printf(<span class="stringliteral">&quot;exit.\n&quot;</span>);</div><div class="line">    <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<div class="footer" style="text-align: right;">
	<hr/>
	<small></small>
</div>
<script>
	// 当前选中的菜单
	var currentMenuItem = document.querySelector('.tablist > li.current > a')
	if (currentMenuItem) { // 子菜单情况
	  window.parent.postMessage({
		navHref: currentMenuItem.href
	  }, '*')
	} else {
	  window.parent.postMessage({
		url: window.location.href
	  }, '*')
	}
  </script>
</body>
</html>